home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Hyper / Q-R / Q&A.cpt / Galaxies / stack.txt < prev   
Text File  |  1987-12-01  |  6KB  |  204 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x0 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 1
  11. -- first background id: 2623
  12. -- card count: 6
  13. -- first card id: 2963
  14. -- list block id: 3260
  15. -- print block id: 3540
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 0
  19. -- free size: 0 bytes
  20. -- total size: 17472 bytes
  21. -- stack block size: 5120 bytes
  22. -- created by hypercard version: 0x00000000
  23. -- compacted by hypercard version: 0x00000000
  24. -- modified by hypercard version: 0x00000000
  25. -- opened by hypercard version: 0x00000000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x0000220000002200
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0xCC003300CC003300
  30. -- patterns[4]: 0xCC883322CC883322
  31. -- patterns[5]: 0xFF00FF00FF00FF00
  32. -- patterns[6]: 0xEECCBB33EECCBB33
  33. -- patterns[7]: 0xFFCCFF33FFCCFF33
  34. -- patterns[8]: 0xFFEEFFBBFFEEFFBB
  35. -- patterns[9]: 0xFFFFFFBBFFFFFFBB
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x5555555555555555
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. on openStack
  69.   global firsttime
  70.   global totalcorrect
  71.   global numberanswered
  72.   global ncards
  73.   put the number of cards into ncards
  74.   go to first card
  75.  
  76.   put true into firsttime
  77.   put 0 into totalcorrect
  78.   put 0 into numberanswered
  79.   put 0 into background field "percentcorrect"
  80.   show background field "answermask"   --  hides the answers
  81.   set lockText of background field "answer1" to true   -- allow editing
  82.   set lockText of background field "answer2" to true
  83.   set lockText of background field "answer3" to true
  84.   set lockText of background field "answer4" to true
  85.   set lockText of background field "answer5" to true
  86.   set lockText of background field "theQuestion" to true
  87.   set lockText of background field "why" to true
  88.   hide background button "help"
  89.   show background field "reviewmask"
  90.   hide menubar
  91.  
  92.   repeat with i = 1 to ncards
  93.     put false into background field "got it right" of card i
  94.   end repeat
  95.  
  96. end openStack
  97.  
  98. on CloseStack
  99.   set visible of background button "help" to false
  100.   set visible of background field "reviewmask" to true
  101.   set visible of background field "gobackmask" to true
  102. end CloseStack
  103.  
  104. on opencard
  105.   global totalcorrect
  106.   global ncards
  107.   global firsttime
  108.   global numberanswered
  109.  
  110.   if numberanswered = ncards then  -- all done
  111.     pop card
  112.     exit opencard
  113.   end if
  114.  
  115.   if firsttime then  -- first time through
  116.     if id of this card <> id of first card then
  117.       hide background field "gobackmask"
  118.     else
  119.       show background field "gobackmask"  -- can't go back on card 1
  120.     end if
  121.   else -- we are in review mode
  122.     show background field "gobackmask"  -- no goback in review mode
  123.   end if
  124.  
  125.   if background field "got it right" = true then  -- skip this card
  126.     go to next card
  127.   else  -- this card has not been answered
  128.     put round(100 * totalcorrect / the number of cards) into it
  129.     put it into background field "percentcorrect"
  130.     show background field "percentcorrect"  -- it was hidden earlier
  131.     -- prevents flickering
  132.     put the number of this card into background field "cardnumber"
  133.     put ncards into background field "numberofcards" -- so it is updated
  134.     -- since by this time the user is reading the question it does not
  135.     -- slow things down.
  136.   end if
  137. end opencard
  138.  
  139. on process
  140.   global firsttime
  141.   global totalcorrect
  142.   global numberanswered
  143.   global response
  144.   global ncards
  145.   get background field "correctanswer"
  146.   if it = response then
  147.     play "Sax Lo" tempo 200 "ce e g a#w."
  148.     put true into correct
  149.     put true into background field "got it right"
  150.     add 1 to totalcorrect
  151.     add 1 to numberanswered
  152.   else
  153.     play "boing" ge
  154.     put false into correct
  155.     put false into background field "got it right"
  156.   end if
  157.  
  158.   put 0 into response
  159.  
  160.   if firsttime then  -- check to see if we are at the end of the stack
  161.     if id of last card = id of this card then
  162.       put false into firsttime
  163.       show background button "Help"
  164.       hide background field "reviewmask"
  165.       show background field "gobackmask"
  166.  
  167.       visual effect wipe right
  168.       hide background field "percentcorrect"
  169.     end if
  170.  
  171.   end if
  172.  
  173.   if firsttime then
  174.     if correct then
  175.       visual effect wipe right
  176.       hide background field "percentcorrect"
  177.       go to next card
  178.     else
  179.       visual effect wipe right
  180.       hide background field "percentcorrect"
  181.       go to next card
  182.     end if
  183.   else
  184.     if correct then
  185.       visual effect wipe right
  186.       hide background field "percentcorrect"
  187.       go to next card
  188.     else
  189.       answer "Would you like to try again?" with "No" or "Yes"
  190.       if it = "No" then
  191.         put true into background field "got it right"
  192.         add 1 to numberanswered
  193.         visual effect wipe right
  194.         hide background field "percentcorrect"
  195.         go to next card
  196.       end if
  197.     end if
  198.   end if
  199.  
  200. end process
  201.  
  202.  
  203.  
  204.